// @ts-ignore
/* eslint-disable */
import { request } from "@/utils/request";

/** 获取卡片列表 分页获取卡片列表，支持搜索和过滤 GET /admin/cards */
export async function adminCards(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminCardsParams,
  options?: { [key: string]: any }
) {
  return request<API.PageResponse & { data?: API.Card[] }>(`/admin/cards`, {
    method: "GET",
    params: {
      // page has a default value: 1
      page: "1",
      // page_size has a default value: 20
      page_size: "20",

      ...params,
    },
    ...(options || {}),
  });
}

/** 创建卡片 创建新的学习卡片 POST /admin/cards */
export async function adminCards2(
  body: API.CardCreateRequest,
  options?: { [key: string]: any }
) {
  return request<API.Response & { data?: API.Card }>(`/admin/cards`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 获取卡片详情 根据卡片ID获取卡片详细信息 GET /admin/cards/${param0} */
export async function adminCardsId(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminCardsIdParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<API.Response & { data?: API.Card }>(`/admin/cards/${param0}`, {
    method: "GET",
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 更新卡片信息 更新指定卡片的信息 PUT /admin/cards/${param0} */
export async function adminCardsId2(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminCardsIdParams,
  body: API.CardUpdateRequest,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<API.Response & { data?: API.Card }>(`/admin/cards/${param0}`, {
    method: "PUT",
    headers: {
      "Content-Type": "application/json",
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 删除卡片 软删除指定卡片 DELETE /admin/cards/${param0} */
export async function adminCardsId3(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminCardsIdParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/admin/cards/${param0}`, {
    method: "DELETE",
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 获取卡片详细信息 获取卡片的完整详细信息，包括关联数据 GET /admin/cards/${param0}/detail */
export async function adminCardsIdDetail(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminCardsIdDetailParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<API.Response & { data?: API.Card }>(
    `/admin/cards/${param0}/detail`,
    {
      method: "GET",
      params: { ...queryParams },
      ...(options || {}),
    }
  );
}

/** 发布卡片 将卡片状态设置为已发布 POST /admin/cards/${param0}/publish */
export async function adminCardsIdPublish(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminCardsIdPublishParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/admin/cards/${param0}/publish`, {
    method: "POST",
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 更新卡片状态 更新卡片的发布状态 PUT /admin/cards/${param0}/status */
export async function adminCardsIdStatus(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminCardsIdStatusParams,
  body: API.CardStatusRequest,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/admin/cards/${param0}/status`, {
    method: "PUT",
    headers: {
      "Content-Type": "application/json",
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 取消发布卡片 将卡片状态设置为草稿 POST /admin/cards/${param0}/unpublish */
export async function adminCardsIdUnpublish(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminCardsIdUnpublishParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/admin/cards/${param0}/unpublish`, {
    method: "POST",
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 批量操作卡片 批量发布、取消发布、归档或删除卡片 POST /admin/cards/batch */
export async function adminCardsBatch(
  body: API.CardBatchRequest,
  options?: { [key: string]: any }
) {
  return request<any>(`/admin/cards/batch`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 根据标签获取卡片 根据标签列表获取相关卡片 GET /admin/cards/by-tags */
export async function adminCardsByTags(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminCardsByTagsParams,
  options?: { [key: string]: any }
) {
  return request<API.PageResponse & { data?: API.Card[] }>(
    `/admin/cards/by-tags`,
    {
      method: "GET",
      params: {
        // page has a default value: 1
        page: "1",
        // page_size has a default value: 20
        page_size: "20",
        ...params,
      },
      ...(options || {}),
    }
  );
}

/** 获取热门卡片 获取浏览量或点赞数较高的热门卡片 GET /admin/cards/popular */
export async function adminCardsPopular(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminCardsPopularParams,
  options?: { [key: string]: any }
) {
  return request<API.Response & { data?: API.Card[] }>(`/admin/cards/popular`, {
    method: "GET",
    params: {
      // limit has a default value: 10
      limit: "10",
      ...params,
    },
    ...(options || {}),
  });
}

/** 获取最新卡片 获取最近创建的卡片 GET /admin/cards/recent */
export async function adminCardsRecent(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminCardsRecentParams,
  options?: { [key: string]: any }
) {
  return request<API.Response & { data?: API.Card[] }>(`/admin/cards/recent`, {
    method: "GET",
    params: {
      // limit has a default value: 10
      limit: "10",
      ...params,
    },
    ...(options || {}),
  });
}

/** 搜索卡片 根据关键词搜索卡片 GET /admin/cards/search */
export async function adminCardsSearch(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.AdminCardsSearchParams,
  options?: { [key: string]: any }
) {
  return request<API.PageResponse & { data?: API.Card[] }>(
    `/admin/cards/search`,
    {
      method: "GET",
      params: {
        // page has a default value: 1
        page: "1",
        // page_size has a default value: 20
        page_size: "20",
        ...params,
      },
      ...(options || {}),
    }
  );
}

/** 获取卡片统计信息 获取卡片相关的统计数据 GET /admin/cards/stats */
export async function adminCardsStats(options?: { [key: string]: any }) {
  return request<API.Response & { data?: API.CardStatsResponse }>(
    `/admin/cards/stats`,
    {
      method: "GET",
      ...(options || {}),
    }
  );
}
